from Autotests.BaseTest import AirClientTestCase
from Autotests.LocalMachine.Pages.AirClient.MainPage import WebMainPage


class MainBarTest(AirClientTestCase):
    def test_LsvSetup(self):
        mainPage = WebMainPage()
        mainPage.goToLsvSettings()
        self.assertTrue(mainPage.isLsvTabVisible(), "Dialog 'Options -> Local SpeedKick' didn't appear")

    def test_ScheduleSetup(self):
        mainPage = WebMainPage()
        mainPage.goToSceduleSettings()
        self.assertTrue(mainPage.isScheduleTabVisible(), "Dialog 'Options -> Schedule' didn't appear")

    def test_ManageDevices(self):
        mainPage = WebMainPage()
        if mainPage.goToManageDevicesPage():
            self.assertTrue(mainPage.isAllDevicesPageActive(),
                            "'Login' page wasn't loaded after 'Manage devices' button click")
        else:
            self.assertTrue(mainPage.isTeamViewerVisible(),
                            "'TeamViewer' dialog didn't appear after 'Manage devices' button click")

    def test_AssignToAccount(self):
        mainPage = WebMainPage()
        if mainPage.goToAssignToAccountPage():
            self.assertTrue(mainPage.isTeamViewerVisible(),
                            "'TeamViewer' dialog didn't appear after 'Assign to your account' button click")

    def test_BuyNow(self):
        mainPage = WebMainPage()
        if mainPage.goToBuyNowPage():
            self.assertTrue(mainPage.isBuyNowPageActive(), "'Buy Now' page wasn't loaded")


import unittest
if __name__ == "__main__":
    unittest.main()
